Fix plain-text email formatting - #151
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes HEY’s collapsed formatting for plain-text bodies sent via hey compose and hey reply by converting plain text into escaped, HEY-compatible HTML (paragraphs + line breaks), while adding a --raw-html escape hatch for callers who already supply Action Text/HTML.
Changes:
- Add
formatMessageContenthelper to normalize newlines, trim, escape HTML, and wrap paragraphs/line breaks for HEY rendering. - Wire formatting into both
composeandreply, and add a--raw-htmlflag to bypass formatting. - Add unit tests for the formatter and update the CLI surface snapshot to include the new flags.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/cmd/message_format.go | Introduces plain-text → HEY-compatible HTML formatting helper. |
| internal/cmd/message_format_test.go | Adds unit coverage for paragraph splitting, newline normalization, escaping, raw HTML passthrough, and trimming. |
| internal/cmd/compose.go | Adds --raw-html flag and applies message formatting before send. |
| internal/cmd/reply.go | Adds --raw-html flag and applies message formatting before sending replies. |
| .surface | Updates surface baseline to include the new flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Reject whitespace-only raw HTML content\n- Revalidate formatted compose and reply messages before sending
|
Closing — compose/reply bodies are now treated as Markdown and converted via |
Summary
Plain-text messages sent through
hey composeandhey replycurrently appear as one collapsed paragraph in HEY, even when their input contains blank lines. This change converts ordinary text into escaped HEY-compatible HTML so paragraph and line-break formatting survives rendering, while--raw-htmlkeeps an explicit path for callers that already provide Action Text markup.The behavior was reproduced with a self-email in HEY’s mobile UI, then validated end to end with a patched binary: ordinary plain-text input rendered as separate paragraphs and preserved line breaks.
Validation
make checkSummary by cubic
Fixes collapsed paragraphs in plain-text emails by converting input to HEY-compatible HTML so line breaks and blank lines render in
hey composeandhey reply. Adds--raw-htmlfor preformatted HTML and rejects empty or whitespace-only bodies.Bug Fixes
--raw-html.New Features
--raw-htmltohey composeandhey replyto bypass formatting when sending HEY-compatible HTML.Written for commit 59a1bfa. Summary will update on new commits.